package com.ssy.lingxi.product.controller.mobile;

import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.product.service.IPriceCurveSetService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @menu: APP-价格曲线
 * @author jw.chen
 * @version 2.0.0
 * @date 2021/10/20
 */
@RestController
@RequestMapping("/product/mobile/priceCurveSet")
public class MobilePriceCurveSetController extends BaseController {

    @Resource
    private IPriceCurveSetService priceCurveSetService;

    @Resource
    private HttpServletRequest request;

    /**
     * 查询是否显示价格曲线
     * @param commodityId 商品id
     * @return 是/否显示
     */
    @RequestMapping(value = "/getIsShowPriceCurve", method = RequestMethod.GET)
    public Wrapper<Boolean> getIsShowPriceCurve(@RequestParam("commodityId") Long commodityId) {
        Long shopId = Long.parseLong(request.getHeader("shopId"));
        return Wrapper.success(priceCurveSetService.getPriceCurveSet(shopId, commodityId));
    }

}
